<%-- 
    Document   : penulis_insert
    Created on : 11 Des 12, 13:29:01
    Author     : sydon
--%>

<%@ page import="java.sql.Connection,
         java.sql.DriverManager,
         java.sql.Statement,
         java.sql.ResultSet" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>

        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>Sweat Bee  by Free CSS Templates</title>
        <meta name="keywords" content="" />
        <meta name="description" content="" />
        <link href="style.css" rel="stylesheet" type="text/css" media="screen" />
        <style type="text/css">
            <!--
            .style1 {font-size: 10px}
            .style3 {
                font-size: 24px;
                font-weight: bold;
            }
            -->
        </style>
    </head>
    <body>
        <div id="header-wrapper">
            <div id="header">
                <div id="menu">
                    <ul>
                        <li><a href="LoginServlet?admin=logout" class="style1">Logout</a></li>
                        <li><a href="penulis_insert.jsp?id_filum=all&id_class=all&id_ordo=all&id_familia=all&id_spesies=all">Insert</a></li>
                        <li><a href="penulis_edit.jsp?id_filum=all&id_class=all&id_ordo=all&id_familia=all&id_spesies=all">Edit</a></li>
                        <li><a href="penulis_delete.jsp?id_filum=all&id_class=all&id_ordo=all&id_familia=all&id_spesies=all">Delete</a></li>
                    </ul>
                </div>
                <!-- end #menu -->
                <div id="search">
                    <form method="get" action="">
                        <fieldset>
                            <input type="text" name="s" id="search-text" size="15" />
                            <input type="submit" id="search-submit" value="GO" />
                        </fieldset>
                    </form>
                </div>
                <!-- end #search -->
            </div>
        </div>
        <!-- end #header -->
        <!-- end #header-wrapper -->
        <div id="logo">
            <h1><a href="admin.jsp">Sweat Bee </a></h1>
            <p></p>
        </div>
        <div id="wrapper">
            <div id="page">
                <div id="page-bgtop">
                    <hr />
                    <p>
                        <!-- end #logo -->
                        <span class="style3">Insert Data Hewan Invertebrata</span></p>
                    <div style="clear: both;">&nbsp;</div>
                </div>
            </div>
            <div id="page">
                <div id="page-bgtop">
                    <hr />
                    <!-- end #logo -->
                    <div id="content-admin">
                        <div class="post">
                            <h2 class="title">Data Hewan invertebrata</h2>
                            <div class="entry">
                                <%
                                            bean.DataBaseConnection conn = new bean.DataBaseConnection();
                                            //ResultSet id_filum = null;
                                            //ResultSet id_class = null;
                                            //ResultSet hasilQuery = null;
                                            //ResultSet getIDAC = null;
                                            //ResultSet RuangEdit = null;
                                            //ResultSet getNamaFilum = null;
                                            //ResultSet getNamaFilumUrut = null;
                                            //ResultSet getNamaClass = null;
                                            //ResultSet getNamaClassUrut = null;
                                            //ResultSet getNamaOrdo = null;
                                            //ResultSet getNamaOrdoUrut = null;
                                            //ResultSet getNamaFamilia = null;
                                            //ResultSet getNamaFamiliaUrut = null;
                                            //ResultSet getMerekAC = null;
                                            //ResultSet getJenisAC = null;
                                            //ResultSet getMerekACUrut = null;
                                            //ResultSet getJenisACUrut = null;
                                            //String IDAC = null;
                                            String queryFilum = "Select * from filum ";
                                            java.sql.Statement stm1 = conn.getConnection().createStatement();
                                            java.sql.ResultSet getNamaFilum = stm1.executeQuery(queryFilum);

                                            String queryFilum2 = "Select * from filum order by id_filum ='" + request.getParameter("id_filum") + "' DESC ";
                                            java.sql.Statement stm2 = conn.getConnection().createStatement();
                                            java.sql.ResultSet getNamaFilumUrut = stm2.executeQuery(queryFilum2);

                                            String queryClass = "select * from class where id_filum ='" + request.getParameter("id_filum") + "'";
                                            java.sql.Statement stm3 = conn.getConnection().createStatement();
                                            java.sql.ResultSet getNamaClass = stm3.executeQuery(queryClass);

                                            String queryClass2 = "select * from class where id_filum ='" + request.getParameter("id_filum") + "' order by id_class ='" + request.getParameter("id_class") + "' DESC ";
                                            java.sql.Statement stm4 = conn.getConnection().createStatement();
                                            java.sql.ResultSet getNamaClassUrut = stm4.executeQuery(queryClass2);

                                            String queryOrdo = "select * from ordo where id_class ='" + request.getParameter("id_class") + "'";
                                            java.sql.Statement stm5 = conn.getConnection().createStatement();
                                            java.sql.ResultSet getNamaOrdo = stm5.executeQuery(queryOrdo);

                                            String queryOrdo2 = "select * from ordo where id_class ='" + request.getParameter("id_class") + "' order by id_ordo ='" + request.getParameter("id_ordo") + "' DESC ";
                                            java.sql.Statement stm6 = conn.getConnection().createStatement();
                                            java.sql.ResultSet getNamaOrdoUrut = stm6.executeQuery(queryOrdo2);

                                            String queryFamilia = "select * from familia where id_ordo ='" + request.getParameter("id_ordo") + "'";
                                            java.sql.Statement stm7 = conn.getConnection().createStatement();
                                            java.sql.ResultSet getNamaFamilia = stm7.executeQuery(queryFamilia);

                                            String queryFamilia2 = "select * from familia where id_ordo ='" + request.getParameter("id_ordo") + "' order by id_familia ='" + request.getParameter("id_familia") + "' DESC ";
                                            java.sql.Statement stm8 = conn.getConnection().createStatement();
                                            java.sql.ResultSet getNamaFamiliaUrut = stm8.executeQuery(queryFamilia2);


                                %>
                                <form action="insert.jsp?id_filum=<%out.print(request.getParameter("id_filum"));%>&id_class=<%out.print(request.getParameter("id_class"));%>&id_ordo=<%out.print(request.getParameter("id_ordo"));%>&id_familia=<%out.print(request.getParameter("id_familia"));%>" enctype="multipart/form-data" method="post">
                                    <table width="900" border="0">                                       
                                        <tr> 
                                            <th height="48" align="left" scope="row">Filum</th>
                                            <td colspan="2" align="left">
                                                <select name="nama_filum" id="nama_filum">
                                                    <%
                                                                if (request.getParameter("id_filum").equals("all")) {
                                                                    while (getNamaFilum.next()) {
                                                    %>
                                                    <option onclick="location.href='penulis_insert.jsp?id_filum=<%out.print(getNamaFilum.getString("id_filum") + "&id_class=all&id_ordo=all&id_familia=all");%>'"><%out.print(getNamaFilum.getString("nama_filum"));%></option>
                                                    <%
                                                                                                                        }
                                                                                                                    } else {
                                                                                                                        while (getNamaFilumUrut.next()) {

                                                    %>
                                                    <option onclick="location.href='penulis_insert.jsp?id_filum=<%out.print(getNamaFilumUrut.getString("id_filum") + "&id_class=all&id_ordo=all&id_familia=all");%>'"><%out.print(getNamaFilumUrut.getString("nama_filum"));%></option>
                                                    <%
                                                                    }
                                                                }
                                                    %>
                                                </select>
                                            </td>
                                        </tr>
                                        <%                                                                                              //response.sendRedirect("admin_insert.jsp?id_filum=" + request.getParameter("id_filum") + "&id_class=null");
                                                    System.out.println(request.getParameter("id_filum"));                                                                                               //} else if (request.getParameter("id_filum") != null && request.getParameter("id_class") == null) {
                                        
                                        System.out.print(request.getParameter("nama_filum"));
                                            System.out.print(request.getParameter("nama_filum"));%>
                                        <tr>
                                            <th height="48" align="left" scope="row">Kelas</th>
                                            <td colspan="2" align="left">
                                                <select name="nama_class" size="1" id="nama_class">
                                                    <%
                                                                if (request.getParameter("id_class").equals("all")) {
                                                                    while (getNamaClass.next()) {
                                                    %>
                                                    <option onclick="location.href='penulis_insert.jsp?id_filum=<%out.print(request.getParameter("id_filum"));%>&id_class=<%out.print(getNamaClass.getString("id_class") + "&id_ordo=all&id_familia=all");%>'"><%out.print(getNamaClass.getString("nama_class"));%></option>
                                                    <%
                                                                                                            }
                                                                                                        } else {
                                                                                                            while (getNamaClassUrut.next()) {
                                                    %>
                                                    <option onclick="location.href='penulis_insert.jsp?id_filum=<%out.print(request.getParameter("id_filum"));%>&id_class=<%out.print(getNamaClassUrut.getString("id_class") + "&id_ordo=all&id_familia=all");%>'"><%out.print(getNamaClassUrut.getString("nama_class"));%></option>
                                                    <%                                                   
                                                                    }
                                                                }
                                                    %>
                                                </select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th height="51" align="left" scope="row">Ordo</th>
                                            <td colspan="2" align="left">
                                                <select name="nama_ordo" size="1" id="nama_ordo">
                                                    <%
                                                                if (request.getParameter("id_ordo").equals("all")) {
                                                                    while (getNamaOrdo.next()) {
                                                    %>
                                                    <option onclick="location.href='penulis_insert.jsp?id_filum=<%out.print(request.getParameter("id_filum"));%>&id_class=<%out.print(request.getParameter("id_class"));%>&id_ordo=<%out.print(getNamaOrdo.getString("id_ordo")+"&id_familia=all");%>'"><%out.print(getNamaOrdo.getString("nama_ordo"));%></option>
                                                    <%
                                                                                                            }
                                                                                                        } else {
                                                                                                            while (getNamaOrdoUrut.next()) {
                                                    %>
                                                    <option onclick="location.href='penulis_insert.jsp?id_filum=<%out.print(request.getParameter("id_filum"));%>&id_class=<%out.print(request.getParameter("id_class"));%>&id_ordo=<%out.print(getNamaOrdoUrut.getString("id_ordo")+"&id_familia=all");%>'"><%out.print(getNamaOrdoUrut.getString("nama_ordo"));%></option>
                                                    <%
                                                                    }
                                                                }
                                                    %>
                                                </select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th height="51" align="left" scope="row">Familia</th>
                                            <td colspan="2" align="left">
                                                <select name="nama_familia" size="1" id="nama_familia">
                                                    <%
                                                                if (request.getParameter("id_familia").equals("all")) {
                                                                    while (getNamaFamilia.next()) {
                                                    %>
                                                    <option onclick="location.href='penulis_insert.jsp?id_filum=<%out.print(request.getParameter("id_filum"));%>&id_class=<%out.print(request.getParameter("id_class"));%>&id_ordo=<%out.print(request.getParameter("id_ordo"));%>&id_familia=<%out.print(getNamaFamilia.getString("id_familia"));%>'"><%out.print(getNamaFamilia.getString("nama_familia"));%></option>
                                                    <%
                                                                                                            }
                                                                                                        } else {
                                                                                                            while (getNamaFamiliaUrut.next()) {
                                                    %>
                                                    <option onclick="location.href='penulis_insert.jsp?id_filum=<%out.print(request.getParameter("id_filum"));%>&id_class=<%out.print(request.getParameter("id_class"));%>&id_ordo=<%out.print(request.getParameter("id_ordo"));%>&id_familia=<%out.print(getNamaFamiliaUrut.getString("id_familia"));%>'"><%out.print(getNamaFamiliaUrut.getString("nama_familia"));%></option>
                                                    <%
                                                                    }
                                                                }
                                                    %>
                                                </select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th width="136" height="40" align="left" scope="col">Nama Spesies</th>
                                            <td colspan="2" align="left" scope="col">
                                                <input type="text" name="nama_spesies" id="nama_spesies">
                                            </td>
                                        </tr>
                                        <tr>
                                            <th height="47" align="left" scope="row">Ciri Spesies</th>
                                            <td colspan="2" align="left">
                                                <textarea name="ciri_spesies" id="ciri_spesies" cols="45" rows="5"></textarea>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th height="54" align="left" scope="row">Info</th>
                                            <td colspan="2" align="left">
                                                <textarea name="info_spesies" id="info_spesies" cols="45" rows="5"></textarea>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th height="54" align="left" scope="row">Gambar</th>
                                            <td width="634" align="left">
                                                <input type="file" name="gambar">
                                                <br>(beri nama gambar)
                                            </td>
                                            <td width="108" align="right">&nbsp;</td>
                                        </tr>
                                        <tr>
                                        </tr>
                                        <tr>
                                            <th height="54" align="left" scope="row">&nbsp;</th>
                                            <td align="right"><input type="submit" name="Update" id="Update" value="Update"></td>
                                            <td align="right"><input style="right" type="reset" name="Cancel" id="Cancel" value="Cancel"></td>
                                        </tr>
                                    </table>
                                </form>
                                <%if (session.getAttribute("upload") != null) {%>
                                Upload Berhasil
                                <%
                                                session.removeAttribute("upload");
                                            }
                                %>
                            </div>
                            <span class="entry">		    </span>
                            <form name="form3" method="post" action="">
                                <label></label>
                            </form>
                            <span class="entry">
                                <p>&nbsp;</p>
                            </span></div>
                    </div>
                    <!-- end #content -->
                    <div style="clear: both;">&nbsp;</div>
                </div>
            </div>
        </div>
        <!-- end #page -->
        <div id="footer-bgcontent">
            <div id="footer">
                <p>Copyright (c) 2008 Sitename.com. All rights reserved. <br />
			Template Design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.</p>
            </div>
        </div>
        <!-- end #footer -->
    </body>
</html>